package org.jackysoft.struts2.assets;

import java.util.Collection;

import javax.annotation.Resource;

import org.jackysoft.entity.Department;
import org.jackysoft.entity.Maintainability;
import org.jackysoft.service.MaintainabilityService;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.jackysoft.struts2.UtilsCRUDAction;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;

@Namespace("/maintainability")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class MaintainabilityAction extends UtilsCRUDAction<Maintainability> {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7535299246512777613L;
	private MaintainabilityService service;
	private Maintainability bean;
	private Collection<Maintainability> beans;
	private Department owner;

	public String stat() throws Exception {

		pager = service.statByDate(usedate);
		return "stat";
	}

	public String statdetail() throws Exception {
		pager = service.statByOwner(getOwner(), usedate, page, 10);

		return "statdetail";
	}

	public void setBean(Maintainability bean) {
		this.bean = bean;
	}

	public Maintainability getBean() {
		return this.bean;
	}

	public void setBeans(Collection<Maintainability> beans) {

		this.beans = beans;
	}

	public Collection<Maintainability> getBeans() {
		return this.beans;
	}

	@Resource
	public void setService(MaintainabilityService service) {
		this.service = service;
		this.setDataProvider(service);
	}

	public MaintainabilityService getService() {
		return this.service;
	}

	public Department getOwner() {
		return owner;
	}

	public void setOwner(Department owner) {
		this.owner = owner;
	}

}